﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YasharEl.Infrastructure.Core.Prototype;
using YasharEl.Infrastructure.ObjectFactory.Adapters;

namespace YasharEl.Infrastructure.Core.ServiceModel.Adapters.Maps
{
    public class PropertyMappingToPropertyDefinitionDTOMap : TypeMapConfigurationBase<IPropertyMapping, PropertyDefinitionDTO>
    {
        protected override void BeforeMap(ref IPropertyMapping source)
        {
        }

        protected override void AfterMap(ref PropertyDefinitionDTO target, params object[] moreSources)
        {
            //Don't need
        }

        protected override PropertyDefinitionDTO Map(IPropertyMapping source)
        {
            PropertyDefinitionDTO target = new PropertyDefinitionDTO();

            target.PropertyName = source.PropertyDefinition.Name;
            target.PropertyKey = source.PropertyDefinition.Key;
            target.PropertyDescription = source.PropertyDefinition.Description;
            target.DisplayName = source.PropertyDefinition.DisplayName;

            return target;
        }
    }
}
